"Unknown collection member" in expression
I have a report that I developed about a month ago. The report contains a textbox that has the following expression defined for it:
="Single Project: " + Parameters!Project.Value + " | " &
IIF(Parameters!Currency.Value = "Local"
, "Local Currency: " & First(Fields!Currency_Code.Value, "dsCurrency")
, "Currency: USD"
)
This worked fine until the underlying data had changed and the First function was returning the incorrect value.
So I opened Visual Studio, went into the Datset defintion for the "dsCurrency" dataset and tweaked the MDX query that feeds this data set. Now that my query is returning the correct data, when I go to preview the report, and the Project.Value parameter is
set to "Local", I get an output that looks like this:
Single Project: Project1 | Local Currency:
What I expected to see was:
Single Project: Project1 | Local Currency: JPY
So I went back to my expression above and noticed that Visual Studio "decorated" the Fields!Currency_Code.Value with a red squiggly that when I hover over it says: "Unknown collection member".
I double checked the field definition in the query (it is a MDX query), tried dragging & dropping the value in the expression editor (instead of typing it) all to no avail.
The code is currently running on my production server, but not when I preview it in Visual Studio.
I recall this working fine in Preview mode when I was developing it a month or so ago. What happened and how do I fix it???
November 22nd, 2010 3:13pm
Found Similer thread ,
please haev a look
http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/3d0769d9-9ee0-4ad9-bec2-0eaa5ef83dc2Gaurav Gupta http://sqlservermsbiblog.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2010 7:38pm
Hi JPtak,
From your description, it seems the First(Fields!Currency_Code.Value, "dsCurrency") returned empty, this is why we got "Single Project: Project1 | Local Currency:" only.
In order to troubleshoot the issue, could you please use the following expression in the textbox, and check what it returned?
=First(Fields!Currency_Code.Value, "dsCurrency")
If it returns empty, I would suggest you checking the data returned from the data source.
Thanks,
Jin ChenJin Chen - MSFT
November 23rd, 2010 4:56am
The problem was the query that was feeding the dataset. I was querying two different cubes, one on my laptop and the other in production. Apparently, they were not in sync. Once I got the data sources all lined up, everything worked. However, the squiggly
is still there.
Is this because the textbox wasn't physically bound to the dataset like a Tablix object is? I didnt' see any way to bind the textbox to a dataset...
Free Windows Admin Tool Kit Click here and download it now
November 23rd, 2010 4:34pm
Hi JPtak,
Is the textbox outside a tablix control? If so, the textbox won't bind to a dataset automatically.
We can add a dummy tablix to the report, and add the textbox to the tablix, this will work around the issue.
Thanks,
Jin ChenJin Chen - MSFT
November 23rd, 2010 9:08pm